package routing

import (
	"demo-code/pkg/handler"

	"github.com/gin-gonic/gin"
)

const (
	GET    string = "GET"
	POST   string = "POST"
	PUT    string = "PUT"
	PATCH  string = "PATCH"
	DELETE string = "DELETE"
)

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc gin.HandlerFunc
}

type Routes struct {
	Routes []Route
}

// NewRoutes creates and returns all the API routes
func NewRoutes() (r *Routes) {
	r = new(Routes)
	r.Routes = []Route{
		{
			Name:        "Healthz",
			Method:      GET,
			Pattern:     "/healthz",
			HandlerFunc: handler.Healthz,
		},
		{
			Name:        "业务1",
			Method:      GET,
			Pattern:     "/api/v1/index",
			HandlerFunc: handler.Business1,
		},
		{
			Name:        "业务2",
			Method:      GET,
			Pattern:     "/api/v2/index",
			HandlerFunc: handler.Business2,
		},
	}
	return
}
